#!/usr/bin/env bash

docker stop sc-producer sc-consumer-feign sc-consumer-ribbon
docker rm sc-producer sc-consumer-feign sc-consumer-ribbon
docker image rm cike/producer:latest cike/consumer-feign:latest cike/consumer-ribbon:latest

echo '==================2.安装认证公共包到本地maven仓库=================='
#安装认证公共包到本地maven仓库
cd common && mvn install
echo '当前目录:' && pwd

#回到根目录
cd -

echo '==================8.构建镜像并启动业务(producer/ribbon/feign/admin)相关服务=================='
#构建镜像:组织服务
cd ./demos/producer
mvn package -Dmaven.test.skip=true && mvn docker:build
cd -
cd ./demos/consumer-feign
mvn package -Dmaven.test.skip=true && mvn docker:build
cd -
cd ./demos/consumer-ribbon
mvn package -Dmaven.test.skip=true && mvn docker:build

#回到根目录
cd -

#去docker-compose目录
cd docker-compose

#启动组织服务
docker-compose -f docker-compose.yml -f docker-compose.demos.yml up -d producer
docker-compose -f docker-compose.yml -f docker-compose.demos.yml up -d consumer-ribbon
docker-compose -f docker-compose.yml -f docker-compose.demos.yml up -d consumer-feign

#回到根目录
cd -
